<?php
include_once('common.inc.php');
include_once(__ROOT__.'model/userGroup.class.php');

$act = get_param('action');
$userGroupModel = new UserGroupModel;

switch( $act ):

case 'add':
	if( get_param('name') ){
		$data = get_data('user_group');
		$rs = $userGroupModel->add_group($data);	
		if( $rs ){
			echo '<p>Success!</p>';
		}else{
			echo '<p>'.$userGroupModel->get_error().'</p>';
		}
	}

	echo '
		<fieldset>
			<legend>添加用户组</legend>
			<form action="group.php?action=add" method="post">
				<p>
					<label for="name">用户组名：</label>
					<input type="text" name="name" />
				</p>
				<p>
					<input type="submit" value="Submit" name="submit"  />
				</p>
			</form>
		</fieldset>
	';
break;

endswitch;
